package cn.edu.scau.cmi.wujiaxian.exercise4;

public class Prime_number {
	void prime() {
		System.out.println("ǰ50ǣ");
		int count = 0;
		int i, j;
		for (j = 2;; j++) {
			int flag = 1;
			for (i = 2; i <= Math.sqrt(j); i++) {
				if (j % i == 0) {
					flag = 0;
					break;
				}
			}
			if (flag == 1) {
				count++;
				System.out.println(j + ",");
			}
			if (count == 50)
				break;
		}
	}
}
